function Animate(el,attr,val) {
	this.el = el;
	this.attr = attr;
	this.val = val;
}

Animate.prototype.todo = function() {
	var that = this;
	var fun = this.attr;
	var firstChild = this.el.firstChild;
	var lastChild = this.el.lastChild;
	if (fun=="left") {
		var nowValue = 0;
		var interval = setInterval(function() {
			if(nowValue>=that.val){
				if (fun=="left") {
					that.el.removeChild(firstChild);
					that.el.appendChild(firstChild);
					that.el.style.left = "0px";
				}
				clearInterval(interval);
			}else{
				nowValue+=8;
				that.el.style.left = "-"+nowValue+"px";
			}
		},10);
	}else{
		var nowValue = -this.val;
		this.el.insertBefore(lastChild,this.el.childNodes[0]);
		this.el.style.left=nowValue+"px";
		var interval = setInterval(function() {
			if(nowValue>=0){
				clearInterval(interval);
			}else{
				nowValue+=8;
				that.el.style.left = nowValue+"px";
			}
		},10);
	}
};

export default Animate;